package org.example.service;


import org.example.mapper.CourseMapper;
import org.example.model.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService {
    @Autowired
    private CourseMapper courseMapper;

    public int addCourse(Course course) {
        return courseMapper.insertCourse(course);
    }

    public int updateCourse(Course course) {
        return courseMapper.updateCourse(course);
    }

    public int deleteCourse(Long id) {
        return courseMapper.deleteCourse(id);
    }

    public Course getCourseById(Long id) {
        return courseMapper.getCourseById(id);
    }

    public List<Course> getAllCourses() {
        return courseMapper.getAllCourses();
    }
}